<extend name="Common@Layout:hui-admin" />
<block name="title">
	<title>Administator管理后台</title>
</block>
<block name="style">

</block>

<block name="main">
	<div class="pd-20">
		<form action="{:u('edit_post')}" method="post" class="form form-horizontal validator_form close-dialog" id="form-article-add">
			<div class="row cl">
				<label class="form-label col-2">
					<span class="c-red">*</span>学生姓名：</label>
				<div class="formControls col-4">
					<input name="student" class="input-text" value="{$info.student}" data-rule="学生姓名:required;" />
				</div>
				<div class="col-2"> </div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">
					<span class="c-red">*</span>电话：</label>
				<div class="formControls col-4">
					<input name="tel" class="input-text" value="{$info.tel}" data-rule="电话:required;mobile;" data-rule-mobile="[/^(((13[0-9]{1})|(15[0-35-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/,'请输入正确的手机号码']"
					/>
				</div>
				<div class="col-2"> </div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">
					<span class="c-red">*</span>家长姓名：</label>
				<div class="formControls col-4">
					<input name="jzxm" class="input-text" value="{$info.jzxm}" data-rule="家长姓名:required;" />
				</div>
				<div class="col-2"> </div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">
					<span class="c-red">*</span>学期：</label>
				<div class="formControls col-6">
					<php>if($cUser['role'] == 'ROLE_SUPER_ADMIN' || $cUser['role'] == 'ZHONGJI_GUANLIYUAN_ADMIN' || $cUser['mobile'] == '15925628938'){</php>
					<span class="select-box mb-5">
						<select class="select" size="1" name="tid" id="xueqi">
							<foreach name="xueqi" item="vo">
								<option value="{$vo.id}" <if condition="$vo['id'] eq $info['tid']">selected</if>>{$vo.title}({$vo.start_time}到{$vo.end_time})</option>
							</foreach>
						</select>
					</span>
					<php>}else{</php>
					<foreach name="xueqi" item="vo">
						<if condition="$vo['id'] eq $info['tid']">
							{$vo.title}({$vo.start_time}到{$vo.end_time})
							<input type="hidden" name="tid" value="{$vo.id}" />
						</if>
					</foreach>
					<php>}</php>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">
					<span class="c-red">*</span>班级：</label>
				<div class="formControls col-6">
					<span class="select-box mb-5">
						<select class="select" size="1" name="did" id="xiaoqu">
							<foreach name="xiaoqu" item="vo">
								<option value="{$vo.id}" <if condition="$vo['id'] eq $info['did']">selected="selected"</if>>{$vo.title}</option>
							</foreach>
						</select>
					</span>
					<span class="select-box mb-5">
						<select class="select" size="1" name="cid" id="banji" data-id="{$info['cid']}">

						</select>
					</span>
					<span class="select-box">
						<select class="select" size="1" name="lid" id="lesson" data-id="{$info['lid']}">

						</select>
					</span>
				</div>
				<div class="col-4"> </div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">备注：</label>
				<div class="formControls col-9">
					<textarea name="remark" cols="" rows="" class="textarea" placeholder="说点什么...最少输入10个字符" datatype="*10-100" dragonfly="true"
					    nullmsg="备注不能为空！" onKeyUp="textarealength(this,200)">{$info.remark}</textarea>
					<p class="textarea-numberbar">
						<em class="textarea-length">0</em>/200</p>
				</div>
			</div>
			<div class="row cl">
				<div class="col-9 col-offset-2">
					<input type="hidden" name="id" value="{$info.id}">
					<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				</div>
			</div>
		</form>
	</div>
</block>

<block name="script">
	<script type="text/javascript">
		$(function () {
			$('.skin-minimal input').iCheck({
				checkboxClass: 'icheckbox-blue',
				radioClass: 'iradio-blue',
				increaseArea: '20%'
			});

			$('.mini-time').datepicker();

			$("#xiaoqu").trigger('change');
		});

		$("#xiaoqu").change(function () {
			var did = $(this).val();
			var str = "";
			$.get('/api/ygcl/getclass_new?did=' + did, function (data) {
				var html = ''
				if (data.status) {
					var data_banji = data.data;
					for (var i = 0; i < data_banji.length; i++) {
						data_banji[i].id == $("#banji").attr("data-id") ? str = "selected" : str = "";
						html += '<option value="' + data_banji[i].id + '" ' + str + '>' + data_banji[i].title + '</option>'
					}
					$("#banji").empty().append(html);
					$("#banji").trigger('change');
				}
			})
		})
		$("#banji").change(function () {
			var cid = $(this).val();
			var str = "";
			$.get('/api/ygcl/getlesson_new?cid=' + cid, function (data) {
				var html = ''
				if (data.status) {
					var data_lesson = data.data;
					for (var i = 0; i < data_lesson.length; i++) {
						data_lesson[i].id == $("#lesson").attr("data-id") ? str = "selected" : str = "";
						html += '<option value="' + data_lesson[i].id + '" ' + str + '>' + data_lesson[i].lessonname + '(' +
							data_lesson[i].lessontime + ')</option>'
					}
					$("#lesson").empty().append(html);
				}
			})
		})
	</script>
</block>